#include <iostream>

unsigned long long const mo = 1000000007;
unsigned long long n, m;

unsigned long long quick(unsigned long long a, unsigned long long b)
{
	if (b == 0) return 1;
	unsigned long long t = quick(a, b/2);
	t = (t * t) % mo;
	if (b & 1) t *= a;
	return t % mo;
}

void exgcd(unsigned long long a, unsigned long long b, unsigned long long& x, unsigned long long& y)
{
	if (!b) x = 1LL, y = 0LL;
	else exgcd(b, a % b, y, x), y -= x * (a / b);
}

unsigned long long inv(unsigned long long a, unsigned long long m)
{
	unsigned long long x, y;
	exgcd(a, m, x, y);
	return (x % m + m) % m;
}

unsigned long long reverse(unsigned long long a, unsigned long long m)
{
	if (a == 1) return 1;
	return (reverse(m % a, m) * (m - m/a))%m;
}

unsigned long long calc(unsigned long long a, unsigned long long b)
{
	if (b == 0) return 1;
	unsigned long long t = calc(a, (b-1)/2);
	t += t * quick(a, (b+1)/2);
	t %= mo;
	if (!(b & 1)) t += quick(a, b);
	return t % mo;
}

int main()
{
	while (std::cin >> n >> m) {
		if (!n) { std::cout << "0\n"; continue; }
		unsigned long long ans = 1;
		for(unsigned long long p = 2 ; p*p <= n ; p++){
			if(n % p == 0){
				unsigned long long cnt = 0;
				while(n % p == 0) { n /= p; cnt++; }
				cnt *= m;
				ans = ans * calc(p , cnt) % mo;
			}
		}
		if (n > 1) ans = ans * calc(n, m) % mo;
		std::cout << (ans + mo) % mo << '\n';
	}
}

